home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 3011 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.3 KB

  1. Path: cdc2.cdc.net!sud119
  2. From: mart@vianet.on.ca (Mart)
  3. Newsgroups: comp.lang.c,comp.lang.c++,alt.msdos.programmer
  4. Subject: Clearing the keyboard buffer
  5. Date: Sun, 21 Jan 96 16:45:10 GMT
  6. Organization: CDC Internet - 423/842-5709
  7. Message-ID: <4dtqi4$60u@cdc2.cdc.net>
  8. NNTP-Posting-Host: sud119.vianet.on.ca
  9. X-Newsreader: News Xpress Version 1.0 Beta #4
  10.  
  11.   I'm using Turbo C++ v. 3.1 and I need to be able to clear the keyboard 
  12. buffer.  If there is a function for this, could someone tell me.  If there 
  13. isn't a function, then my guess is that I have to make a call to the keyboard 
  14. interrupt, if this is the case, could you post the required interrupt, 
  15. service, and whatever values that have to be sent/read.
  16.  
  17. BTW, this following bit of code wouldn't work :
  18.  
  19. while(kbhit())
  20. {
  21.     getch();
  22. }
  23.  
  24. Because I want the user to be able to just keep pushing the same key, making 
  25. the above loop infinitly.  If I don't clear the keyboard buffer, my code will 
  26. continue believing that the user is pushing a key, even though their not.
  27.  
  28. Thanks for any help you can give.  Please reply at mart@vianet.on.ca or at
  29. enigma@cwconnect.ca.
  30.  
  31.        /---------------------\
  32.        |  mart@vianet.on.ca  |
  33.        |  (Enigma Software)  |
  34.        |  +705-983-5467      |
  35.        \---------------------/
  36.  
  37. - "If it wasn't for C, we'd be using obol, pasal, basi..."
  38.